import axios from '../axios/index'
import { stringify } from 'tyqs';
import { api, api2, api3 } from './index'
export const getHomeData_l = () => axios.get("");
//测试
export const getData_l = async () => await axios({
  method: "post",
  url: `${api.baseUrlData}/index/getAd`,
  data: stringify({
    'positionCode': "cola_my_banner"
  })
})

// 首页秒杀专场轮播图
export const getMiaosha_c = async () => await axios({
  method: 'post',
  url: `${api.baseUrlData}/index/getAd`,
  data: stringify({
    'positionCode': "cola_home_banner1"
  })
})

// 可乐优品商城介绍
export const getColaDesc_c = async () => await axios({
  method: 'post',
  url: `${api.baseUrlData}/template/info`,
  data: stringify({
    'alias': "27VDg"
  })


})
// 首页分类数据
export const getCateData_c = async () => await axios({
  method: 'post',
  url: `${api.baseUrlData}/index/getAd`,
  data: stringify({
    'positionCode': "cola_home_class"
  })
})

// 大家都在买垂直轮播列表api
export const getPeopleBuyData_c = async () => await axios({
  method: 'post',
  url: `${api.baseUrlData}/api/goods/v1/product/salesVolume`
})

// 大家都在买展示列表api
export const getAllPeopleBuyData_c = async () => await axios({
  method: 'post',
  url: `${api.baseUrlData}/api/advertise/v1/advertise/home`,
  data: stringify({
    'classIds': '101,102,103,104,105',
  })

})

//首页手机列数据默认api
// export const getPhoneListData_c = async (page: number = 0) => await axios({
//   method: 'post',
//   url: `${api.baseUrlData}/api/goods/v1/product/lists`,
//   data: stringify({
//     'pageIndex': page,
//     'pageSize': 10
//   })

// })

// 首页手机数据列表机型请求到的api
export const getPhoneListData_c = async ({ page = 0, classId, brandId, spuId, startPrice, endPrice, conditionId, romId, bodyColorId, versionTypeId, networkTypeId, keyword }: { page: number, classId?: string, brandId?: string, spuId?: string, startPrice?: number, endPrice?: number, conditionId?: string, romId?: string, bodyColorId?: string, versionTypeId?: string, networkTypeId?: string, keyword?: string }) => await axios({
  method: 'post',
  url: `${api.baseUrlData}/api/goods/v1/product/lists`,
  data: stringify({
    'classId': classId,
    'pageIndex': page,
    'pageSize': 10,
    "spuId": spuId,
    'brandId': brandId,
    'startPrice': startPrice,
    'endPrice': endPrice,
    'conditionId': conditionId,
    'romId': romId,
    'bodyColorId': bodyColorId,
    'versionTypeId': versionTypeId,
    'networkTypeId': networkTypeId,
    'keyword': keyword
  })

})

// 可乐秒杀api
export const getColaMiaoData_c = async () => await axios({
  method: 'post',
  url: `${api.baseUrlData}/product/SeckillSubject`,
  data: stringify({
    'status': 1,
    'pageSize': 3
  })

})

// 筛选数据api
export const getChooseData_c = async (classId?: string, brandId?: string, spuId?: string) => await axios({
  method: 'post',
  url: `${api.baseUrlData}/product/spuAttr`,
  data: stringify({
    'classId': classId,
    "spuId": spuId,
    'brandId': brandId,
  })
})

// 机型列表数据
export const getPhoneModuleList_c = async () => await axios({
  method: 'post',
  url: `${api.baseUrlData}/product/className`,
})

// 机型列表选择的banner数据
export const getPhoneModuleBannerList_c = async (classId: string = '1') => await axios({
  method: 'post',
  url: `${api.baseUrlData}/product/brandName`,
  data: stringify({
    'classId': classId,
  })
})

// 默认机型选择热门数据
export const getTopSalesNumProduct_c = async (classId: string = '1') => await axios({
  method: 'post',
  url: `${api.baseUrlData}/product/topSalesNumProduct`,
  data: stringify({
    'classId': classId,
    'topNum': 10
  })
})

// 选择机型的第三级数据
export const getSpuListProduct_c = async (classId: string = '1', brandId: string) => await axios({
  method: 'post',
  url: `${api.baseUrlData}/product/spuName`,
  data: stringify({
    'classId': classId,
    'brandId': brandId
  })
})

// 详情页数据
export const getDetailProduct_c = async (id: string) => await axios({
  method: 'post',
  url: `${api.baseUrlData}/product/productInfo`,
  data: stringify({
    'id': id,
  })
})

// 详情页评论数据
export const getDeatilComments_c = async (pageSize: number = 1, proId: string) => await axios({
  method: 'post',
  url: `${api.baseUrlData}/api/v1/evaluate/index`,
  data: stringify({
    'pageSize': pageSize,
    'proId': proId,
  })
})

// 详情页买家秀数据
export const getDeatilBuy_c = async (pageSize: number = 4, proId: string, pic: string = '1') => await axios({
  method: 'post',
  url: `${api.baseUrlData}/api/v1/evaluate/index`,
  data: stringify({
    'pageSize': pageSize,
    'proId': proId,
    'pic': pic
  })
})

// 详情页为你推荐数据
export const getDeatiltj_c = async (id: string) => await axios({
  method: 'post',
  url: `${api.baseUrlData}/product/recommendSimilarGoods`,
  data: stringify({
    'id': id,
  })
})


// 分类页的侧边栏数据
export const getCateGory_c = async () => await axios({
  method: 'post',
  url: `${api.baseUrlData}/Classify/info`,
})

// 分类页右边具体数据
export const getCateGoryDataList_c = async (classId: string) => await axios({
  method: 'post',
  url: `${api.baseUrlData}Classify/detailsV2`,
  data: stringify({
    'classId': classId,
  })
})


// 搜索结果页面的banner
export const getSearchBanner_c = async () => await axios({
  method: 'post',
  url: `${api.baseUrlData}/product/bannerInfo`,
})

// 可乐秒杀数据
export const getMiaoShaData_c = async () => await axios({
  method: 'post',
  url: `${api2.baseUrlData}/api/v2/seckill/subject`,
  data: stringify({
    'id': 4429,
    'pageSize': 20,
    'pageIndex': 0,
  }),

})


// 可乐秒杀倒计时
export const getMiaoShaTime_c = async () => await axios({
  method: 'post',
  url: `${api2.baseUrlData}/api/v2/seckill/spikeFieldList`,
})

// 可乐直播数据
export const getColaZb_c = async () => await axios({
  method: 'post',
  url: `${api3.baseUrlData}/api/v1/live/index`,
})
// 可乐直播调研
export const getColaZbDy_c = async () => await axios({
  method: 'post',
  url: `${api.baseUrlData}/index/getAd`,
  data: stringify({
    'positionCode': 'cola_live_code',
  })
})


//获取种草的视频列表
export const getVideoList_l = async (page: number = 0) => await axios({
  method: "post",
  url: `${api.baseUrlData}/find/videoV2`,
  data: stringify({
    'contentId': 300,
    'pageSize': api.pageSize,
    "pageIndex": page
  })
});

//获取种草的头条列表
export const getHeadlineList_l = async (page: number = 0) => await axios({
  method: "post",
  url: `${api.baseUrlData}/find/headLine`,
  data: stringify({
    "pageIndex": page,
    "pageSize": api.pageSize
  })
});
//获取头条详情
export const getHeadlineDetail_l = async (id: string) => await axios({
  method: "post",
  url: `${api.baseUrlData}/find/findInfo`,
  data: stringify({
    id
  })
});
//获取头条评论
export const getHeadlineComment_l = async (id:string)=>await axios({
  method:"post",
  url:`${api.baseUrlData}/find/lists`,
  data:stringify({
    contentId:id
  })
});

//获取买家秀的tag
export const getBuyShowTags_l = async () => await axios({
  method: "post",
  url: `${api.baseUrlData}/index/getAd`,
  data: stringify({
    'positionCode': "cola_comment_tag"
  })
});
//获取买家秀的列表
export const getBuyShowList_l = async (tag: string = '全部', page?: number) => await axios({
  method: "post",
  url: `${api.baseUrlData}/evaluate/evaList`,
  data: stringify({
    'searchKey': tag,
    'pageIndex': page || 0,
    'pageSize': api.pageSize
  })
});
//获取购物车猜你喜欢
export const getGuessLikeList_l = async (page: number = 0) => await axios({
  method: "post",
  url: `${api.baseUrlData}/api/recommend/v1/recommend/guessYouLike`,
  data: stringify({
    pageSize: api.pageSize,
    pageIndex: page
  })
});
//获取我的页面广告
export const getMineAdList_l = async () => await axios({
  method: "post",
  url: `${api.baseUrlData}/index/getAd`,
  data: stringify({
    'positionCode': "cola_my_banner"
  })
});
//获取我的页面标签数据
export const getMineTags_l = async () => await axios({
  method: "post",
  url: `${api.baseUrlData}/api/icon/v1/icon/index`
});
